/**
 * Created by on 2018/5/4.
 */
define(function () {

    var self,
        app = win.app,
        search,
        orderSubmitArg = app.pageParameters['gwaq553bflc_page'];;



    var bflc = app.Module.extend({

        init: function () {
            self = this;
            self.searchData = {
                keyword: '1'
            };
            self._super({
                _tag: 'p_list', // key, 对象放进pageModule
                _refreshAutoInit: true //自动加载刷新控件
            }, win);

            mui.ready(function () {

                Vue.component('bflcitem', {
                    template: app.getByid(doc, 'bflcitem-template'),
                    props: {
                        model: Array
                    },
                    methods: {

                    }
                });

                search = new Vue({
                    el: app.getByid(doc, 'searchDiv1'),
                    data: {
                        keyword:self.searchData.keyword

                    },
                    methods: {
                        toSearch: function () {
                            self.searchData.keyword = search.keyword;
                            self._refresh();
                        }
                    }
                });
            })



        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scroll1'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/gwaq553/getBflcPage",
                xdata: {
                    page:goods.page+1,
                    limit: goods.limit,
                    GWBHNAME:orderSubmitArg.GWBHNAME,
                    keyword:self.searchData.keyword
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        goods.data.pushArray(data.data, goods.page == 0);

                        _super({
                            obj: goods,
                            dataLen: data.data.length,
                            nodata: '无拜访历程信息...'
                        });
                    }
                }
            });
        },
        _lazy: function () {
            this._super();

        },
        _ready: function () {



        }
    });

    return new bflc();

});